import request from '../request';
import {
  GET_IAP_COMMODITY_LIST_REQ,
  IAP_BUY_YU_TOU_COIN_REQ,
  GET_IAP_BUY_YU_TOU_COIN_PAY_RESULT_REQ,
  GET_YU_TOU_COIN_HISTORY_REQ
} from '../../service/constant';
import { GetIAPCommodityListRes } from './getIAPCommodityList';
import {
  getIAPBuyYutouCoinPayResultParams,
  IAPBuyYutouCoinParams
} from './paramsInterface';
import { IAPBuyYutouCoinRes } from './IAPBuyYutouCoin';
import { GetIAPBuyYutouCoinPayResultRes } from './getIAPBuyYutouCoinPayResult';
import { GetYutouCoinHistoryRes } from './getYutouCoinHistory';

export default {
  // 获取IAP充值列表
  getIAPCommodityList: (): Promise<GetIAPCommodityListRes> =>
    request({
      msgId: GET_IAP_COMMODITY_LIST_REQ,
      param: { needUserId: true }
    }),
  // IAP蜜蜂币充值
  IAPBuyYutouCoin: (data: IAPBuyYutouCoinParams): Promise<IAPBuyYutouCoinRes> =>
    request({
      msgId: IAP_BUY_YU_TOU_COIN_REQ,
      data,
      param: { needToast: false }
    }),
  // 获取IAP购买蜜蜂币的订单状态
  getIAPBuyYutouCoinPayResult: (
    data: getIAPBuyYutouCoinPayResultParams
  ): Promise<GetIAPBuyYutouCoinPayResultRes> =>
    request({
      msgId: GET_IAP_BUY_YU_TOU_COIN_PAY_RESULT_REQ,
      data,
      param: { needToast: false }
    }),
  // 获取IAP充值消费记录
  getYutouCoinHistory: (): Promise<GetYutouCoinHistoryRes> =>
    request({
      msgId: GET_YU_TOU_COIN_HISTORY_REQ,
      param: { needUserId: true }
    })
};
